import { TableColumnData } from '@arco-design/web-vue';
import {
  IconClockCircle,
  IconCheckCircle,
  IconCloseCircle,
  IconMinusCircle,
} from '@arco-design/web-vue/es/icon';

// 类型定义
export type StatusType = 0 | 1 | 2 | 3;
export type CategoryType = 'TECH' | 'LIFE' | 'RESOURCE' | 'OTHER';

// 静态配置：分类选项
export const categoryOptions = [
  {
    label: '全部',
    value: '',
  },
  {
    label: '技术博客',
    value: 'TECH',
  },
  {
    label: '生活博客',
    value: 'LIFE',
  },
  {
    label: '资源网站',
    value: 'RESOURCE',
  },
  {
    label: '其他',
    value: 'OTHER',
  },
];

// 静态配置：状态配置映射
export const STATUS_CONFIG = {
  0: {
    color: 'orange',
    text: '待审核',
    icon: IconClockCircle,
  },
  1: {
    color: 'green',
    text: '正常',
    icon: IconCheckCircle,
  },
  2: {
    color: 'gray',
    text: '下线',
    icon: IconMinusCircle,
  },
  3: {
    color: 'rgb(var(--danger-6))',
    text: '驳回',
    icon: IconCloseCircle,
  },
} as const;

// 静态配置：分类映射
export const CATEGORY_MAP = {
  TECH: {
    text: '技术博客',
    color: 'blue',
  },
  LIFE: {
    text: '生活博客',
    color: 'green',
  },
  RESOURCE: {
    text: '资源网站',
    color: 'purple',
  },
  OTHER: {
    text: '其他',
    color: 'orange',
  },
} as const;

export const columns: TableColumnData[] = [
  {
    title: 'logo',
    dataIndex: 'logo',
    align: 'center',
    slotName: 'logo',
    width: 100,
  },
  {
    title: '网站名称',
    dataIndex: 'name',
    align: 'center',
    width: 150,
  },
  {
    title: '网站链接',
    dataIndex: 'url',
    align: 'center',
    width: 200,
  },
  {
    title: '网站描述',
    dataIndex: 'description',
    align: 'center',
    width: 250,
    tooltip: true,
    ellipsis: true,
  },
  {
    title: '站长邮箱',
    dataIndex: 'email',
    align: 'center',
    width: 200,
  },
  {
    title: '状态',
    dataIndex: 'status',
    align: 'center',
    slotName: 'status', // 推荐用 slot 显示状态标签
    width: 100,
  },
  {
    title: '分类',
    dataIndex: 'category',
    align: 'center',
    slotName: 'category',
    width: 100,
  },
  {
    title: '排序',
    dataIndex: 'sort',
    align: 'center',
    width: 100,
  },
  {
    title: '点击次数',
    dataIndex: 'views',
    align: 'center',
    width: 100,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    align: 'center',
  },
  {
    title: '更新时间',
    dataIndex: 'updateTime',
    align: 'center',
  },
  {
    title: '操作',
    align: 'center',
    dataIndex: 'operation',
    width: 200,
    fixed: 'right',
    slotName: 'operation',
  },
];
